home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 7 / FM Towns Free Software Collection 7.iso / t_os / gpen32k / source.exe / LSRC / CMP.C next >
Text File  |  1993-03-24  |  920b  |  50 lines

  1. /*    新しさのチェック    */
  2. /*    古い方を返す        */
  3.  
  4. #include    <dos.h>
  5. #include    <stdlib.h>
  6. #include    <string.h>
  7. #include    <direct.h>
  8. #include    <ctype.h>
  9.  
  10. #ifdef    LSI_C
  11.  
  12. #define _MAX_PATH 144
  13. #define _MAX_DRIVE 3
  14. #define _MAX_DIR 130
  15. #define _MAX_FNAME 9
  16. #define _MAX_EXT 5
  17.  
  18. #endif
  19.  
  20.  
  21. void main( int argc, char *argv[] )
  22. {
  23.     char dr[_MAX_DRIVE], di[_MAX_DIR], fn[_MAX_FNAME], ex[_MAX_EXT];
  24.     unsigned int a;
  25.     struct find_t ff;
  26.     struct find_t fs;
  27.  
  28.     if (argc != 3)
  29.         exit(1);
  30.     _splitpath( argv[1], dr, di, fn, ex );
  31.     if ( strlen(dr)>1 )
  32.     {
  33.         _dos_setdrive( toupper(dr[0])-'A'+1, &a );
  34.     }
  35.     if ( strlen(di) )
  36.     {
  37.         di[strlen(di)-1] = 0;
  38.         chdir( di );
  39.     }
  40.     if (_dos_findfirst( argv[1], _A_NORMAL, &ff)==0 &&
  41.         _dos_findfirst( argv[2], _A_NORMAL, &fs)==0)    {
  42.         if ((ff.wr_date < fs.wr_date) ||
  43.             (ff.wr_date == fs.wr_date && ff.wr_time < fs.wr_time))    {
  44.             exit(2);
  45.         }
  46.         exit(3);
  47.     }
  48.     exit(1);
  49. }
  50.